<template>
	<view class="container-user"
		style="background: url('/static/imgbgc2.png') no-repeat; background-size: 100% 100%;">
		<scroll-view scroll-y="true" class="main" style="height: 100vh;">
			<view :style="{height:`100rpx`}"></view>
			<view class="" style="padding: 0 20rpx;">
				<Cportrait ref='isdata' right="set" @changeLang="getdata"></Cportrait>
			</view>
			<!-- <view :style="{height:`${statusBarHeight}px`}"></view> -->
			<view class="tj-sction">
				<view class="tj-item" v-for="(item,index) in balanceList" :key='index' @click="onDetali(item)">
					<view>{{item.name}}</view>
					<view class="num">{{item.money}}</view>
				</view>
			</view>
			<view class="inform">
				<view class="inform-info" v-if="newsList.length>0">
					<view class="picture" @click="jump(`/pageB/news/news?type=0&name=${$t('user.name74')}`)">
						<image src="/static/newProject/gg_icon.png" mode=""></image>
					</view>
					<view class="info">
						<swiper class="swiper" :circular="true" :vertical="true" :indicator-dots="false"
							:autoplay="true" :interval="3000" :duration="1000">
							<swiper-item v-for="(item,index) in newsList" :key="index">
								<view class="swiper-item" @click="jump(`/pageB/news/news?type=0&name=${$t('user.name74')}`)">
									<text class="one-omit">{{item.title}}</text>
								</view>
							</swiper-item>
						</swiper>
					</view>
				</view>
			</view>
			<view class="vip_box flex-between">
				<view class="item">
					<view class="box" @tap="$fun.jump(`/pageA/wallet/wallet`)">
						<image style="height: 100rpx;" src="@/static/user/img1.png" mode=""></image>
						<image class="img" src="../../static/lr/1.png" mode=""></image>
					</view>
					<view class="text">{{$t('user.name1')}}</view>
				</view>
				<view class="item">
					<view class="box" @tap="$fun.jump('/pageA/wallet/chooseRecharge')">
						<image src="@/static/user/img2.png" mode=""></image>
						<image class="img" src="../../static/lr/1.png" mode=""></image>
					</view>
					<view class="text">
						{{$t('user.name2')}}
					</view>
				</view>
				<view class="item">
					<view class="box" @tap="$fun.jump('/pageA/wallet/withdrawalCoins')">
						<image src="@/static/user/img3.png" mode=""></image>
						<image class="img" src="../../static/lr/1.png" mode=""></image>
					</view>
					<view class="text">
						{{$t('user.name3')}}
					</view>
				</view>
				<view class="item">
					<view class="box" @tap="$fun.jump('/pageB/otcCenter/otcCenter')">
						<image src="@/static/user/img4.png" mode=""></image>
						<image class="img" src="../../static/lr/1.png" mode=""></image>
					</view>
					<view class="text">
						{{$t('user.name4')}}
					</view>
				</view>

			</view>
			<!-- 订单 -->
			<view class="order-section">
				<view class="order-item" @click="$fun.jump('/pageA/order/order?state=1')" hover-class="common-hover"
					:hover-stay-time="50">
					<view class="">
						<image style="width: 64rpx;height: 64rpx;" src="@/static/user/obligation.png" mode=""></image>
					</view>
					<text>{{$t('user.name5')}}</text>
				</view>
				<view class="order-item" @click="$fun.jump('/pageA/order/order?state=2')" hover-class="common-hover"
					:hover-stay-time="50">
					<view class="">
						<image style="width: 64rpx;height: 64rpx;" src="@/static/user/shipped.png" mode=""></image>
					</view>
					<text>{{$t('user.name6')}}</text>
				</view>
				<view class="order-item" @click="$fun.jump('/pageA/order/order?state=3')" hover-class="common-hover"
					:hover-stay-time="50">
					<view class="">
						<image style="width: 64rpx;height: 64rpx;" src="@/static/user/received.png"></image>
					</view>
					<text>{{$t('user.name7')}}</text>
				</view>
				<view class="order-item" @click="$fun.jump('/pageA/order/order?state=4')" hover-class="common-hover"
					:hover-stay-time="50">
					<view class="">
						<image style="width: 64rpx;height: 64rpx;" src="@/static/user/Completed.png" mode=""></image>
					</view>
					<text>{{$t('user.name8')}}</text>
				</view>
				<!-- <view class="" style="width: 4rpx; height: 100rpx;background-color: #ff6754;"></view> -->
				<view class="order-item" @click="$fun.jump('/pageA/order/order?state=0')" hover-class="common-hover"
					:hover-stay-time="50">
					<view class="">
						<image style="width: 64rpx;height: 64rpx;" src="@/static/user/all.png" mode=""></image>
					</view>
					<text>{{$t('user.name9')}}</text>
				</view>
			</view>
			<u-cell-group :border="false">
				<u-cell :border="false" :clickable="false" @click="jump(item.url)" size="large"
					v-for="(item,index) in ywList" :key="index" icon="share" :title="item.name" :isLink="true"
					arrow-direction="arrow-right" :titleStyle="{color:'#232323',fontSize:'28rpx'}">
					<view class="" slot="icon">
						<image style="width: 40rpx;height: 40rpx;" :src="$fun.imgUrl(item.image)" mode=""></image>
					</view>
				</u-cell>
			</u-cell-group>
			<view class="" style="height: 120rpx;">

			</view>
		</scroll-view>
		<TabBar :tabBarShow="4"></TabBar>
	</view>
</template>

<script>
	import Cportrait from '@/components/c-portrait/c-portrait'
	export default {
		components: {
			Cportrait
		},
		data() {
			return {
				userInfo: {},
				balanceList: [],
				list: [],
				ywList: [],
				statusBarHeight: 0,
				newsList: [],
			};
		},
		// 分享好友
		onShareAppMessage() {
			return {
				title: 'smartbox',
				path: JSON.parse(uni.getStorageSync('gitH5Qrcode')),
			}
		},
		// 分享朋友圈
		onShareTimeline() {
			return {
				title: 'smartbox',
				query: JSON.parse(uni.getStorageSync('gitH5Qrcode')),
			}
		},
		async onLoad() {
			uni.hideTabBar()
		},
		async onShow() {
			const phoneInfo = uni.getSystemInfoSync(); // 获取手机系统信息
			this.statusBarHeight = phoneInfo.statusBarHeight
			this.getdata()
			this.$nextTick(()=>{
				this.$refs.isdata.getuser()
			})
		},
		methods: {
			async getdata(){
				await this.$fun.ajax.post('user/balance', {}).then(res => {
					if (res.code == 1) {
						this.balanceList = res.data
					}
				})
				await this.$fun.ajax.post('index/category', {}).then(res => {
					if (res.code == 1) {
						this.ywList = res.data
					}
				})
				const res = await this.$fun.ajax.post('news/index', {})
				this.newsList = res.data
			},
			jump(url) {
				if (url.indexOf('http') != -1) {
					this.$fun.jump(`/pageA/webView/webView?url=${url}&name=网络测速`, 0, 0)
				} else {
					this.$fun.jump(url, 0, 0)
				}
			},
			uploadPic() {
				let _this = this
				uni.chooseImage({
					count: 1,
					success: res => {
						let tempFilePaths = res.tempFilePaths[0]
						uni.uploadFile({
							url: this.$baseUrl + '/api/common/upload', // 仅为示例，非真实的接口地址 
							filePath: tempFilePaths,
							name: 'file',
							header: {
								token: uni.getStorageSync('token')
							},
							success(res) {
								var res = JSON.parse(res.data)
								let userDate = {
									avatar: res.data.url,
								}
								_this.$fun.ajax.post('user/profile', {
									...userDate
								}).then(res1 => {
									if (res.code == 1) {
										_this.userInfo.avatar = res.data.fullurl

									}
								})
							},
						})
					}
				})
			},
			onDetali(item) {
				this.$fun.jump('/pageA/wallet/wallet')
			}
		}
	}
</script>

<style lang="scss">
	page {
		height: 100vh;
	}

	.container-user {
		// position: relative;
		height: 100vh;
	}

	::v-deep .u-cell--clickable {
		background-color: transparent !important;
	}

	.main {

		// position: absolute;
		// top: 0;
		// left: 0;
		// right: 0;
		// bottom: 0;
		// padding: 30rpx;
		.inform {
			margin: 20rpx 30rpx;

			.inform-info {
				background-color: #B0CFFF;
				display: flex;
				height: 70rpx;
				border-radius: 30rpx;
				

				.picture {
					display: flex;
					align-items: center;
					margin: 0 10rpx 0 20rpx;

					image {
						width: 54rpx;
						height: 54rpx;
					}
				}

				.info {
					width: 80%;
					height: 100%;

					.swiper {
						width: 100%;
						height: 100%;

						.swiper-item {
							display: flex;
							align-items: center;
							width: 100%;
							height: 100%;

							text {
								font-size: 24rpx;
								color: #232323;
							}
						}
					}
				}
			}
		}
	}

	.top_box {
		position: absolute;
		top: 0;
		width: 100%;
		height: 251rpx;
		box-sizing: border-box;

		image.bg {
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			z-index: -100;
		}

		.top_info {
			margin-top: 46rpx;
			padding: 0 30rpx;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.l {
				display: flex;
				align-items: center;

				.img {
					width: 120rpx;
					height: 120rpx;
					background: #EEEEEE;
					border-radius: 50%;
					display: flex;
					justify-content: center;
					align-items: center;

					image {
						width: 79rpx;
						height: 85rpx;
					}
				}

				.tel {
					margin-left: 17rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					font-size: 32rpx;
					color: #232323;
				}

				.tel1 {
					margin-left: 17rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #232323;
				}
			}

			.r {
				image {
					width: 45rpx;
					height: 42rpx;
				}
			}

			.wallet {
				width: calc(100% - 60rpx);
				height: 240rpx;
				background: #FFFFFF;
				// box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
				border-radius: 20rpx;

				.top_box1 {
					display: flex;
					padding: 10rpx 30rpx;
					justify-content: space-between;
					align-items: center;

					.l {
						display: flex;

						.text {
							font-size: 30rpx;
							font-family: Microsoft YaHei;
							color: #333333;
						}

						image {
							margin-left: 10rpx;
							width: 24rpx;
							height: 18rpx;
						}
					}

					.r {
						display: flex;

						.button {
							padding: 12rpx 30rpx;
							background: #FFFFFF;
							// border: 2rpx solid #1E84F1;
							border-radius: 25rpx;
							text-align: center;
							font-size: 22rpx;
							font-family: Microsoft YaHei;
							color: #1E84F1;
						}
					}

				}

				.wallet_box {
					width: 100%;
					display: flex;
					justify-content: space-between;
					padding: 30rpx;
					padding-top: 0;

					.wallet_item {
						width: 50%;

						view:nth-child(1) {
							font-size: 30rpx;
							font-family: Microsoft YaHei;
							font-weight: bold;
							color: #333333;
						}

						view:nth-child(2) {
							margin-top: 10rpx;
							font-size: 30rpx;
							font-family: Microsoft YaHei;
							font-weight: bold;
							color: #333333;

						}

					}
				}

			}

			.ab {
				position: absolute;
				left: 30rpx;
				bottom: -100rpx;
			}
		}
	}

	.wallet1 {
		width: calc(100% - 60rpx);
		height: 200rpx;
		margin: 20rpx 30rpx;
		background: #FFFFFF;
		// box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
		border-radius: 20rpx;

		.top_box1 {
			display: flex;
			padding: 20rpx 30rpx;
			justify-content: space-between;
			align-items: center;

			.l {
				display: flex;

				.text {
					font-size: 28rpx;
					font-family: Microsoft YaHei;

					font-weight: bold;
					color: #333333;
				}

				image {
					margin-left: 10rpx;
					width: 24rpx;
					height: 18rpx;
				}
			}

			.r {
				display: flex;

				.button {
					padding: 12rpx 30rpx;
					background: #FFFFFF;
					// border: 2rpx solid #1E84F1;
					border-radius: 25rpx;
					text-align: center;
					font-size: 28rpx;
					font-family: Microsoft YaHei;
					color: #1E84F1;
				}
			}

		}

		.wallet_box {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 30rpx;
			padding-bottom: 15rpx;
			padding-top: 0;

			.wallet_item {
				width: 50%;
				text-align: center;

				view:nth-child(1) {
					font-size: 28rpx;
					font-family: Microsoft YaHei;
					color: #333333;
				}

				view:nth-child(2) {
					margin-top: 10rpx;
					font-size: 28rpx;
					font-family: Microsoft YaHei;
					color: #333333;

				}

				image {
					width: 50rpx;
					height: 50rpx;
				}
			}
		}

	}

	.imgs_box {
		display: flex;
		justify-content: space-between;
		padding: 20rpx 30rpx;

		image {
			width: 330rpx;
			height: 160rpx;
			// box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
			border-radius: 10rpx;
		}
	}

	.user_content {
		margin: 0 30rpx;
		padding: 20rpx 0;
		display: flex;
		justify-content: center;
		background: #FFFFFF;
		box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.1);
		border-radius: 20rpx;

		.user_item {
			width: 20%;
			text-align: center;
			margin-right: 30rpx;

			image {
				width: 80rpx;
				height: 80rpx;
			}

			.text {
				color: #333333;
				font-size: 24rpx;
			}
		}
	}

	.user_content1 {
		margin: 30rpx;
		padding: 20rpx 40rpx;
		display: flex;
		// justify-content: space-between;
		box-sizing: border-box;
		background: #FFFFFF;
		// box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.1);
		border-radius: 20rpx;
		flex-wrap: wrap;

		.user_item {
			width: 20%;
			text-align: center;
			margin: 20rpx 0;

			image {
				width: 64rpx;
				height: 64rpx;
			}

			.text {
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #232323;
				margin-top: 10rpx;
			}
		}
	}

	.tj-sction {
		padding: 40rpx;
		// width: 690rpx;
		// height: 610rpx;
		// background: url('../../static/Group1410138873@2x.png') no-repeat;
		// background-size: 100% 100%;
		margin: 34rpx 12rpx 0rpx;
		// flex-wrap: wrap;
		// background: #FFFFFF;
		// box-shadow: 0px 0px 11px 0px rgb(0 0 0 / 10%);
		// border-radius: 11px;
		// margin: 0 16px;

		// @extend %section;
		.tj-item {
			// width: 33%;
			// @extend %flex-center;
			width: 604rpx;
			height: 90rpx;
			margin: 0 auto;
			padding: 8rpx 50rpx;
			font-size: $font-sm;
			color: #232323;
			margin-bottom: 20rpx;
			font-weight: 400;
			font-size: 24rpx;
			border: 1rpx solid #FFD19A;
			border-radius: 20rpx;
			background-color: #FFFFFF;
		}

		text {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 24rpx;
			color: #ababab;
		}

		.num {
			font-family: DIN, DIN;
			font-weight: 500;
			font-size: 32rpx;
			color: #232323;
		}
	}

	.order-section {
		display: flex;
		align-items: flex-start;
		justify-content: space-around;
		border-radius: 10rpx 10rpx;
		margin: 50rpx 32rpx 40rpx;
		padding: 30rpx;
		background-color: #B0CFFF;

		.order-item {
			display: flex;
			align-items: center;
			justify-content: flex-start;
			flex-direction: column;
			width: 120upx;
			height: 120upx;
			border-radius: 10upx;
			font-size: $font-sm;
			color: #232323;
		}

		.yticon {
			font-size: 48upx;
			margin-bottom: 18upx;
			color: $base-color;
		}

		.icon-shouhoutuikuan {
			font-size: 44upx;
		}
	}

	.vip_box {
		margin: 20rpx;
		padding: 0 20rpx;
		align-items: flex-start;
		.item{
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 25%;
			position: relative;
		}
		.img{
			width: 100rpx;
			height: 100rpx;
			animation: spin 5s linear infinite;
			position: absolute;
			left: 0;
			z-index: 0;
			@keyframes spin {
				0%{
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.1;
				}
				15% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.35;
				 }
				25% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.55;
				 }
				 35% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.75;
				  }
				50% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.9;
		
				 }
				 65% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.75;
				  }
				75% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.55;
		
				}
				85% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.35;
				 }
				100% {
					// transform: matrix(1, 0, 0, 1, 272, 272);
					opacity: 0.15;
				}
			}
		}
		.text {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 24rpx;
			color: #232323;
			line-height: 28rpx;
			text-align: center;
		}

		.box {
			width: 100rpx;
			height: 100rpx;
			position: relative;

			text {
				position: absolute;
				top: 50%;
				left: 20rpx;
				transform: translateY(-50%);
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #e6e6e6;
			}
		}

	}
</style>